# _*_ coding : utf-8 _*_
# @Time : 2023/8/26 11:24
# @Author : 寻梦
# @File : 08_豆瓣电影第一页
# @Project : code
# 请求路径
import urllib.request

base_url="https://movie.douban.com/j/chart/top_list?type=5&interval_id=100%3A90&action=&start=0&limit=20"
headers={
    "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36 SLBrowser/8.0.1.5162 SLBChan/30",
}
resquest=urllib.request.Request(url=base_url,headers=headers,method="GET")
response= urllib.request.urlopen(resquest)
content=response.read().decode('utf8')
with open('data/douban01.json','w',encoding="utf-8") as fp:
    fp.write(content)

